<fieldset>
    <legend>条件搜索</legend>
    <form action="{:request()->url()}" autocomplete="off" class="layui-form layui-form-pane form-search" method="get"
          onsubmit="return false">

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">喷漆师傅</label>
            <label class="layui-input-inline">
                <input class="layui-input" name="painter" placeholder="请输入喷漆师傅" value="{:input('painter')}">
            </label>
        </div>

        <div class="layui-form-item layui-inline">
            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>

            <!--{if auth("indexExport")}-->
            <button class="layui-btn layui-btn-primary"
                    data-form-export="{:url('indexExport')}?painter={:input('painter')}&month={:input('month')}}" type="button">
                <i class="layui-icon layui-icon-export"></i> 导 出
            </button>
            <!--{/if}-->

            <!--{if auth("indexExport")}-->
            <button class="layui-btn layui-btn-primary"
                    data-form-export="{:url('indexExport')}?painter={:input('painter')}&month={:input('month')}}&is_rework=1&paint_status=0" type="button">
                <i class="layui-icon layui-icon-export"></i> 导出返工记录
            </button>
            <!--{/if}-->
        </div>
    </form>

</fieldset>

<script>
    window.form.render();
    var title = "司机结算表"
    require(['excel'], function (excel) {
        excel.bind(function (data) {

            var items = [];

            items.push(['ID', '对接日期', '完成日期', '城市', '归属城市', '司机', '车牌', '师傅结算费用（元）', '覆盖面结算费用（元）', '总额（元）',
                '电话', '车型', '喷漆状态', '尾部喷漆', '车身颜色', '首次邀约情况', '首次邀约日期', '最近邀约情况', '最近邀约日期', '喷漆师傅', '是否有覆盖', '广告覆盖是否收费', '覆盖几面',
                '是否返工',
                '返工原因',
            ]);
            data.forEach(function (item) {
                items.push([
                    {v: item.id, t: 'n'},
                    item.time_docking,
                    item.time_complete,
                    item.province + item.city + item.area,
                    item.city_owner || '',
                    item.username || '',
                    item.plate_number || '',
                    item.painter_price || '',
                    item.cover_price || '',
                    parseFloat(parseFloat(item.painter_price) + parseFloat(item.cover_price)),
                    item.phone || '',
                    item.car_vehicle_type || '',
                    item.paint_status_text || '',
                    item.end_paint_status === 1 ? '是' : '否',
                    item.car_color || '',
                    item.invite_remark || '',
                    item.time_invite || '',
                    item.invite_remarks || '',
                    item.time_invites || '',
                    item.painter || '',
                    item.has_cover_text || '',
                    item.ad_cover_fee_text || '',
                    item.cover_num || '',
                    item.is_rework === 1 ? '是' : '否',
                    item.reason,
                ]);
            });
            return items;
        }, title);
    });


</script>
